/*
 *                        .::::.
 *                      .::::::::.
 *                     :::::::::::
 *                  ..:::::::::::'
 *               '::::::::::::'
 *                 .::::::::::
 *            '::::::::::::::..
 *                 ..::::::::::::.
 *               ``::::::::::::::::
 *                ::::``:::::::::'        .:::.
 *               ::::'   ':::::'       .::::::::.
 *             .::::'      ::::     .:::::::'::::.
 *            .:::'       :::::  .:::::::::' ':::::.
 *           .::'        :::::.:::::::::'      ':::::.
 *          .::'         ::::::::::::::'         ``::::.
 *      ...:::           ::::::::::::'              ``::.
 *     ````':.          ':::::::::'                  ::::..
 *                        '.:::::'                    ':'````..
 *
 * @Author: byx
 * @Date: 2022-11-26 15:09:52
 * @LastEditors: byx
 * @LastEditTime: 2022-12-03 20:00:30
 * @version: 1.0
 * @Descripttion: wwww.byx1024.top
 */

import { Router, Route, Switch, Redirect } from 'react-router-dom'
import history from 'utils/history'
import Layout from 'pages/Layout'
import Login from 'pages/Login'
import NotFound from 'pages/NotFound'
import AuthRoute from 'components/AuthRoute'

function App() {
  return (
    <Router history={history}>
      <div className="App">
        {/* 测试是否配置成功 */}
        {/* <Link to="/login">登录</Link>
        <Link to="/lcayout">首页</Link> */}

        {/* 配置路由规则 */}
        <Switch>
          {/* 重定向必须放在Switch 里面 */}
          <Redirect exact from="/" to="/home"></Redirect>
          <AuthRoute path="/home" component={Layout}></AuthRoute>
          <Route path="/login" component={Login}></Route>
          {/* 404组件 */}
          <Route component={NotFound}></Route>
        </Switch>
      </div>
    </Router>
  )
}

export default App
